import java.util.HashMap;
import java.util.Map;


public class Fibonacci {

	static Map<Integer, Integer> fibVal = new HashMap<Integer, Integer>();
	
	public static void main(String[] args) {
		System.out.println(fibonacci(45));
		System.out.println(factorial(5));
	}

	public static int fibonacci(int n){
		if(n == 0 || n == 1)
			return 1;
		else if(fibVal.containsKey(n))
			return fibVal.get(n);
		else{
			int resu = fibonacci(n-1)+fibonacci(n-2);
			fibVal.put(n, resu);
			return resu;
		}
	}
	
	public static int factorial(int n){
		if(n == 0)
			return 1;
		else
			return n * factorial(n-1);
	}
}
